package com.byb.server.domain;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.springframework.data.elasticsearch.annotations.Document;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Objects;

/**
 * 服务便捷评分
 */
@ApiModel(description = "服务便捷评分")
@Entity
@Table(name = "service_inv")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
@Document(indexName = "serviceinv")
public class ServiceInv implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    /**
     * 服务指标1
     */
    @ApiModelProperty(value = "服务指标1")
    @Column(name = "index_1")
    private String index1;

    /**
     * 指标评价描述
     */
    @ApiModelProperty(value = "指标评价描述")
    @Column(name = "info")
    private String info;

    /**
     * 得分
     */
    @ApiModelProperty(value = "得分")
    @Column(name = "score")
    private Float score;

    @ManyToOne
    private Product product;

    // jhipster-needle-entity-add-field - Jhipster will add fields here, do not remove
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getIndex1() {
        return index1;
    }

    public ServiceInv index1(String index1) {
        this.index1 = index1;
        return this;
    }

    public void setIndex1(String index1) {
        this.index1 = index1;
    }

    public String getInfo() {
        return info;
    }

    public ServiceInv info(String info) {
        this.info = info;
        return this;
    }

    public void setInfo(String info) {
        this.info = info;
    }

    public Float getScore() {
        return score;
    }

    public ServiceInv score(Float score) {
        this.score = score;
        return this;
    }

    public void setScore(Float score) {
        this.score = score;
    }

    public Product getProduct() {
        return product;
    }

    public ServiceInv product(Product product) {
        this.product = product;
        return this;
    }

    public void setProduct(Product product) {
        this.product = product;
    }
    // jhipster-needle-entity-add-getters-setters - Jhipster will add getters and setters here, do not remove

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        ServiceInv serviceInv = (ServiceInv) o;
        if (serviceInv.getId() == null || getId() == null) {
            return false;
        }
        return Objects.equals(getId(), serviceInv.getId());
    }

    @Override
    public int hashCode() {
        return Objects.hashCode(getId());
    }

    @Override
    public String toString() {
        return "ServiceInv{" +
            "id=" + getId() +
            ", index1='" + getIndex1() + "'" +
            ", info='" + getInfo() + "'" +
            ", score='" + getScore() + "'" +
            "}";
    }
}
